package com.xtedu.examproject.util;

import java.util.List;

public class PageHelper<T> {
    private List<T> items;
    private int pageIndex;
    private int pageSize;
    private int totalPages;
    private int currentPage;
    private String servletName;

    public List<T> getItems() {
        return items;
    }

    public void setItems(List<T> items) {
        this.items = items;
    }

    public int getPageIndex() {
        return pageIndex;
    }

    @Override
    public String toString() {
        return "PageHelper{" +
                "items=" + items +
                ", pageIndex=" + pageIndex +
                ", pageSize=" + pageSize +
                ", totalPages=" + totalPages +
                ", currentPage=" + currentPage +
                ", servletName='" + servletName + '\'' +
                '}';
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public String getServletName() {
        return servletName;
    }

    // 添加 getTotalCount 方法，返回 totalPages 的值
    public int getTotalCount() {
        return totalPages;
    }

    // 添加 setTotalCount 方法
    public void setTotalCount(int totalCount) {
        this.totalPages = totalCount;
    }

    public void setServletName(String servletName) {
        this.servletName = servletName;
    }

    public PageHelper(List<T> list,int pageIndex,int pageSize,int totalPages,String servletName,int currentPage){
        this.items=list;
        this.pageIndex=pageIndex;
        this.pageSize=pageSize;
        this.totalPages=totalPages;
        this.servletName=servletName;
        this.currentPage=currentPage;
    }
}
